package com.android.videotest;

import android.content.res.Resources;
import android.view.View;

import com.danikula.videocache.HttpProxyCacheServer;

/**
 * 项目名称：VideoTest
 * 类 名 称：Urls
 * 类 描 述：TODO
 * 创建时间：2019-11-15 10:11
 * 创 建 人：sansecy
 */
public class Urls {
    //    public static final String videoUrl = "http://video.htd.cn/sv/2e1d7394-16e6824c18c/2e1d7394-16e6824c18c.mp4";
//    public static final String videoUrl = "http://video.htd.cn/sv/1de5dadf-16e682445ee/1de5dadf-16e682445ee.mp4";
    public static final String videoUrl = "https://b2cimg.htd.cn/20191028104102_条码秤规则.mp4";
//    public static final String videoUrl2 = "rtsp://192.168.1.106:1935";
//    public static final String videoUrl2 = "http://223.110.234.31/wh7f454c46tw2600490212_-364226850/ott.mobaibox.com/16/16/20210223/281714578/281714578.mp4?OTTUserToken=15895892617-0C:C6:55:AD:01:8E&accountinfo=egS8%2F1%2F66TKNhNx%2BiZ7eL4GZ2eaPg%2FO4lJXy6NuhOxKo3fl6dkWNqX%2FWSATNKsXGNW27FgTbEfDqAUEhFRzhoy3HhxHiqQ9xwdI7urq2Zw905Negn5jRneEMuhHrBpv9JF0xKlCnfecXJSPTSmJGGA%3D%3D%3A20220622185734%2C15895892617%2C112.2.5.46%2C20220622185734%2Cpjsag003630100000000000000000023%2C0FDE8274C46EF939774EAC0EC8BFA2FB%2C%2C1%2C0%2C-1%2C%2C1%2C%2C-1%2C-3%2C1%2CEND&GuardEncType=2&UserName=15895892617&servicetype=0&icpid=16&RTS=1655897176&from=96&hms_devid=2034&vqe=3";
    public static final String shuangyinqijing = "https://gcache.migu.cn/prod/upload/game_resource/channel_for_homepage_game2/202509/0315/18/20250903151844858.mp4";
//    public static final String videoUrl2 = "https://gcache.migu.cn/prod/upload/game_resource/channel_for_homepage_game2/202507/2911/04/20250729110405731.mp4";
//    public static final String videoUrl2 = "http://runvideo.cmgame.com/training/video/20200226/102463_%E4%BA%A7%E5%90%8E%E8%BA%AB%E5%A7%BF%E6%81%A2%E5%A4%8D-1080-%E6%9C%89%E5%A3%B0%E7%89%88~1.mp4";
    public static final String videoUrl3 = "http://mgcdn.vod.migucloud.com/vi1/352.31XU31VJZfEEOGhhPQMS4.2.HMHf0w.mp4";
    public static String cacheVideoUrl(String url) {
        HttpProxyCacheServer proxy = App.getProxy();
        return proxy.getProxyUrl(url);
    }

    private static final String TAG = "Urls-App";


    public static View findDecorView(View view) {
        View targetView = null;
        while ((view = (View) view.getParent()) instanceof View) {
            targetView = view;
        }
        return targetView;
    }

    public static View findContentView(View view) {
        View targetView = null;
        Resources r = view.getResources();
        while ((view = (View) view.getParent()) instanceof View) {
            targetView = view;
            if (r.getResourceEntryName(view.getId()).equals("content")) {
                break;
            }
        }
        return targetView;
    }

    public static View findDecorContentParent(View view) {
        View targetView = null;
        Resources r = view.getResources();
        while ((view = (View) view.getParent()) instanceof View) {
            targetView = view;
            if (r.getResourceEntryName(view.getId()).equals("decor_content_parent")) {
                break;
            }
        }
        return targetView;
    }
}
